package com.itheima.edu.info.manager.controller;

import com.itheima.edu.info.manager.domain.Teacher;
import com.itheima.edu.info.manager.service.TeacherService;

import java.util.Scanner;

public class OtherTeacherController extends BaseTeacherController {

    public void addTeacher() {
        String id= null;
        while (true) {
            System.out.println("请输入老师工号：");
            id = sc.next();
            boolean que=teacherService.query(id);
            if (que){
                break;
            }else{
                System.out.println("工号已存在，请重新输入：");
            }
        }
        System.out.println("请输入老师姓名：");
        String name=sc.next();
        System.out.println("请输入老师年龄：");
        String age=sc.next();
        System.out.println("请输入老师生日(格式：****—**—**)：");
        String birth=sc.next();
        Teacher teacher=new Teacher(id,name,age,birth);
        boolean join=teacherService.judge(teacher);
        if (join){
            System.out.println("添加成功");
        }else{
            System.out.println("添加失败");
        }
    }
}
